package net.Stratus.ImageDumper;

import net.Stratus.ImageDumper.GUI.JobViewer;
import net.Stratus.ImageDumper.GUI.ManageJobs;
import net.Stratus.ImageDumper.Sites.Flickr;

public class Main {
	private static Thread gui;
	public static void main(String args[]) {
		// create and run the gui thread
		gui = new Thread() {
			@Override
			public void run() {
				super.run();
				ManageJobs.create();
			}			
		};
		gui.start();
		
		
				
			try {
			while(!ManageJobs.hasWindows()) Thread.sleep(100);
		} catch (Exception e) {}
					
		while(ManageJobs.hasWindows()) {
			ManageJobs.updateDataAll();	
			JobViewer.updateDataAll();
			try {
				Thread.sleep(333);
			} catch (Exception e) {}
		}
		// no active windows, exit by kill all threads
		for(Job job : Job.getJobs()) 
			job.inturuptThread();
		gui.interrupt();
		System.exit(0);
	}
}
